package com.lj.mcore.tools;

import com.lj.mcore.entity.GoodsCart;
import com.lj.mcore.utils.CommUtils;

import java.util.List;

public class StoreCartTools {

    /**
     * 购物车对本店铺商品，个数操作时，计算针对购买本店铺下商品总价，
     * @param goodsCarts
     * @return
     */
    public static double count_storeCart_price(List<GoodsCart> goodsCarts){
        double total_price=0.00;
        for (GoodsCart goodsCart:goodsCarts){
            double sell_price = CommUtils.mul(goodsCart.getPrice().doubleValue(),goodsCart.getCount());
            total_price = CommUtils.add(total_price,sell_price);
        }
        return total_price;
    }
}
